<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CategoryDetail.ascx.cs" Inherits="admin_webparts_Plug_ins_Category_CategoryDetail" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Import Namespace="NTTHAO.Web.BL.Category" %>
<style type="text/css">
    .yuibtn {font-size:1.1em; font-weight: bold; }
    .yuibtn button { font-family: Verdana,Arial,Helvetica,sans-serif; font-weight: bold; }
</style>
<div class="tip">
    <h1 style="left: 0px; position: relative;"><%=LanguageUtility.GetLanguageText("CATEGORY_DETAIL", Session)%></h1>
    <div style="display: block; width: 32px; height: 32px; float: right; position: relative; top: -27px;"><a title="<%=LanguageUtility.GetLanguageText("CLICK_RETURN", Session) %>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>"><img src="resources/images/Back.png" alt="" /></a></div>
</div>
<%if(_Cat != null) { %>
<table cellspacing="0" cellpadding="3" border="1" class="grid" style="margin: 0px auto 10px;">
    <tr class="even">
        <td align="right" width="200px"><%=LanguageUtility.GetLanguageText("NAME", Session)%>: </td>
        <td><b><%=this._Cat.Name%></b></td>
    </tr>
    <tr class="odd">
        <td align="right"><%=LanguageUtility.GetLanguageText("VALUE_TYPE", Session)%>: </td>
        <td><%=this._Cat.ValueType%></td>
    </tr>
    <tr class="even">
        <td align="right"><%=LanguageUtility.GetLanguageText("SELECT_TYPE", Session)%>: </td>
        <td><%=this._Cat.SelectType%></td>
    </tr>
    <tr class="odd">
        <td align="right"><%=LanguageUtility.GetLanguageText("ACTIVE", Session)%>: </td>
        <td><%=(this._Cat.Actived ? "<img src=\"resources/images/active_l.png\"" : "<img src=\"resources/images/inactive_l.png\"")%></td>
    </tr>
</table>
<div class="tip">
	<h2 style="padding-top: 0px;"><%=LanguageUtility.GetLanguageText("ITEM_LIST", Session)%></h2>
</div>
<style type="text/css">
    .yuibtn {font-size:1.1em; font-weight: bold; }
    .yuibtn button { font-family: Verdana,Arial,Helvetica,sans-serif; font-weight: bold; }
</style>
<p>
    <span id="addItem" class="yui-button yui-link-button yuibtn yuibtn-icon btnadd"><span class="first-child"><a href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=additem&catid=<%=_Cat.ID %>" tabindex="0"><%=LanguageUtility.GetLanguageText("ADD_NEW", Session)%></a></span></span>
</p>
<script type="text/javascript">
    YAHOO.util.Event.onContentReady('addItem', function () {
        var oAddItem = new YAHOO.widget.Button("addItem");
    });
</script>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid" style="margin-top: 10px;">
    <tr>
        <th width="20px">#</th>
        <th><%=LanguageUtility.GetLanguageText("NAME", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("VALUE", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("DEFAULT_SELECT", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("ACTIVE", Session)%></th>
        <th width="42px">&nbsp;</th>
    </tr>
<%
    System.Data.DataTable tb = _Cat.CatItems;
    if (tb != null)
    {
        for (int i = 0; i < tb.Rows.Count; i++)
        {
            System.Data.DataRow row = tb.Rows[i];
            string id = row[CatItem.ID__COLUMN_NAME].ToString();
            string name = row[CatItem.NAME__COLUMN_NAME].ToString();
            string value = row[CatItem.VALUE__COLUMN_NAME].ToString();
            bool defaultSelect = (bool)row[CatItem.DEFAULTSELECT__COLUMN_NAME];
            bool actived = (bool)row[CatItem.ACTIVED__COLUMN_NAME];
%>
    <tr class="<%=(i%2==1?"even":"odd") %>">
        <td align="center"><%=i + 1 %></td>
        <td><b><%=name %></b></td>
        <td><%=value%></td>
        <td align="center"><%=(defaultSelect ? "<img src=\"resources/images/active_l.png\"" : "<img src=\"resources/images/inactive_l.png\"")%></td>
        <td align="center"><%=(actived ? "<img src=\"resources/images/active_l.png\"" : "<img src=\"resources/images/inactive_l.png\"")%></td>
        <td align="center">
            <ul class="icon" style="width: 140px;">
            <%if (defaultSelect) { %>
                <li><a title="<%=LanguageUtility.GetLanguageText("UNSET_DEFAULT", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=defaultnotselect&catid=<%=_Cat.ID %>&id=<%=id %>" class="icon inactivebn">&nbsp</a></li>
            <%} else { %>
                <li><a title="<%=LanguageUtility.GetLanguageText("SET_DEFAULT", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=defaultselect&catid=<%=_Cat.ID %>&id=<%=id %>" class="icon activebn">&nbsp</a></li>
            <%} %>
                <li><a title="<%=LanguageUtility.GetLanguageText("EDIT", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=edititem&catid=<%=_Cat.ID %>&id=<%=id %>" class="icon editbn">&nbsp</a></li>
                <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=deleteitem&catid=<%=_Cat.ID %>&id=<%=id %>" class="icon deletebn" onclick="javascript: return confirm('<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace("<br />", "\\n")%>');">&nbsp</a></li>
                <li><a title="<%=LanguageUtility.GetLanguageText("MOVE_UP", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=moveitem&catid=<%=_Cat.ID %>&id=<%=id %>&move=up" class="icon ascbn">&nbsp</a></li>
                <li><a title="<%=LanguageUtility.GetLanguageText("MOVE_DOWN", Session)%>" href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=moveitem&catid=<%=_Cat.ID %>&id=<%=id %>&move=down" class="icon descbn">&nbsp</a></li>
            </ul>
        </td>
    </tr>
<%
        }
    }
%>
</table>
<%} %>